<script>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Categories background script-- Handles sound selection and other actions within background scope. The handlers for all-- background fields and buttons reside here for convenience.---- Saturn Systems, © 1991---- November 19, 1991--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------function handleSelection-- Handle the text selection within the field "Displayed_Sounds"global pathNameglobal resNameput the clickLine into myClickLineselect myClickLinewait until the mouse is upif the mouseLoc is not within rect of field Displayed_Sounds thenselect emptyexit handleSelectionend ifput word 2 of myClickLine into choiceNumberselect line choiceNumber of field Displayed_Soundsput item 1 of line choiceNumber of field Displayed_Sounds into resName -- Sound nameput item 1 of line 1 of field Path_info & resName into pathName -- Path nameplayend handleSelection------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------on copytoClipglobal pathNameglobal resNameif resName is "" thenput "Please select a sound" into alertStranswer alertStr with "OK"exit copytoClipend if-- SAVE TO CLIPBOARD HEREsndToScrap( pathName )if the result is not empty thenput the result&": "&resName into errStranswer errStr with "OK"end ifend copytoClipon copytoResFileglobal pathNameglobal resNameask file "Save Sound as:" with resName -- Present standard file dialogput the result into resultCodeif resultCode is empty thenput it into outFNameset the cursor to "watch"put copyFile(pathName, outFName) into resultCode -- Save to fileif resultCode is not 0 thenif resultCode is not -48 thenif resultCode is -43 thenput "File '"&pathName&"' not found" into errStranswer errStr with "OK"elseOSErr resultCodeend ifend ifend ifend ifend copytoResFileon copytoFileglobal pathNameglobal resNameask file "Save Sound as:" with resName -- Present standard file dialogput the result into resultCodeif resultCode is empty thenput it into outFNameset the cursor to "watch"put sndToFileFN( pathName,outFName ) into resultif the result is not empty thenput the result&": "&resName into errStranswer errStr with "OK"end ifend ifend copytoFileon copySound-- Handles the command COPY... Currently, this saves only to an external file.global pathNameglobal resNameif resName is "" thenput "Please select a sound" into alertStranswer alertStr with "OK"exit copySoundend ifanswer "Save Sound in Format : " with "Resource" or "File" or "Cancel"put it into saveOptionif saveOption is not "Cancel" thenif saveOption is "Resource" thencopytoResFileelsecopytoFileend ifend ifend copySound-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- on findLocalString-- -- This find method has its domain as the current card. The global find string is retained,-- -- however. This is identical to the global find, except that only this card is searched.-- global findString-- Ask "Please enter a string for which to search: " with findString-- if the result is not "Cancel" then-- put it into findString-- Put "Find Next" into ansFindAgain-- repeat while ansFindAgain is "Find Next"-- if findString is not Empty then-- find string findString in BG field "Displayed_Sounds" in marked cards-- if the result is "not found" then-- Answer "'"&findString&"' was not Found" With "OK"-- put it into ansFindAgain -- OK forces Failure of Loop-- else-- Answer "Find '"&findString&"' Again?" With¬-- "Done" or "Find Next"-- put it into ansFindAgain -- Done forces Failure of Loop-- end if-- else-- put "null" into ansFindAgain-- end if-- end repeat-- end if-- end findLocalString------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------on play-- Plays the selected soundglobal pathNameglobal resName-- put pathname && resNameif resName is "" then -- If no file is selected...put "Please select a sound" into alertStranswer alertStr with "OK"exit playend ifset the cursor to "busy" -- Set the "busy" cursorplaySound pathName, resName -- Play the sound (XCMD)if the result is not empty thenput the result&"(more memory) : "&resName into errStranswer errStr with "OK"end ifend play------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------on autoPlay-- Plays the sounds within this category in sequential order until the user clicks the mouseput "" into BG field "Sound_Name"set visible of BG field Sound_Name to trueput the number of lines of BG field "Displayed_Sounds" into numLinesrepeat until the mouseClickput 1 into SNrepeat for numLines timesif the mouseClick thenset visible of BG field Sound_Name to falseexit autoPlayend ifput (item 1 of line SN of BG field "Displayed_Sounds") into resNameput (item 1 of line 1 of BG field "Path_Info") & resName into pathNameput resName into BG field Sound_NameplaySound pathName, resNameif the result is not empty thenput the result&": "&resName into errStranswer errStr with "OK"end ifadd 1 to SNend repeatend repeatset visible of BG field Sound_Name to falseend autoPlay------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------on openCardglobal pathNameglobal resNameunmark all cards -- Need to mark only this card formark this card -- the local FIND command-- put short name of this card into background field Card_Nameset scroll of background field Displayed_Sounds to 0put "" into resNamepass openCardend openCard------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------on closeCardpass closeCardend closeCard------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</script>